#include <bits/stdc++.h>
using namespace std;
#define mm(a) memset(a,0,sizeof(a));

int Map[10][10];
string data[10];
 
bool dfs(int row, int col) {
    if (row < 0 || row > 9 || col < 0 || col > 9) return true;
    if (Map[row][col] == 1) return false;
    Map[row][col] = 1;
    if (data[row][col] == 'U') return dfs(row - 1, col);
    else if(data[row][col] == 'D') return dfs(row + 1, col);
    else if (data[row][col] == 'L') return dfs(row, col - 1);
    else return dfs(row, col + 1);
}

int main()
{
    // 读入数据
    data[0] = "UDDLUULRUL";
    data[1] = "UURLLLRRRU";
    data[2] = "RRUURLDLRD";
    data[3] = "RUDDDDUUUU";
    data[4] = "URUDLLRRUU";
    data[5] = "DURLRLDLRL";
    data[6] = "ULLURLLRDU";
    data[7] = "RDLULLRDDD";
    data[8] = "UUDDUDUDLL";
    data[9] = "ULRDLUURRR";
    int res = 0;
    for (int row = 0; row < 10; row++) {
        for (int col = 0; col < 10; col++) {
            mm(Map);
            if (dfs(row, col)) res++;
        }
    }
    cout << res << endl;
    return 0;
}